CC = gcc
CFLAGS = -Wall -Wextra -pedantic -std=c11 -O2 -g
LDFLAGS = 

# 定义两个目标
TARGETS = simple_gtk_app simple_atspi_client

# GTK应用程序设置
GTK_TARGET = simple_gtk_app
GTK_SRC = simple_gtk_app.c
GTK_PKG = gtk+-3.0

# ATSPI客户端设置
ATSPI_TARGET = simple_atspi_client
ATSPI_SRC = simple_atspi_client.c
ATSPI_PKG = atspi-2 glib-2.0 gobject-2.0

# 获取pkg-config设置
GTK_CFLAGS = $(shell pkg-config --cflags $(GTK_PKG))
GTK_LDFLAGS = $(shell pkg-config --libs $(GTK_PKG))

ATSPI_CFLAGS = $(shell pkg-config --cflags $(ATSPI_PKG))
ATSPI_LDFLAGS = $(shell pkg-config --libs $(ATSPI_PKG))

# 主目标
all: $(TARGETS)

# 编译GTK应用程序
$(GTK_TARGET): $(GTK_SRC)
	$(CC) $^ -o $@ $(CFLAGS) $(GTK_CFLAGS) $(GTK_LDFLAGS)

# 编译ATSPI客户端
$(ATSPI_TARGET): $(ATSPI_SRC)
	$(CC) $^ -o $@ $(CFLAGS) $(ATSPI_CFLAGS) $(ATSPI_LDFLAGS)

clean:
	rm -f $(TARGETS)

.PHONY: all clean